//
//  LimitTimeViewController.m
//  HaoHaiSpell
//
//  Created by haohai on 16/6/22.
//  Copyright © 2016年 海城. All rights reserved.
//

#import "LimitTimeViewController.h"
#import "LimitCell.h"
@interface LimitTimeViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong)UITableView *limitTableView;
@property (nonatomic,strong)LXSegmentScrollView *segementView;
@property (nonatomic,strong)NSMutableArray *titleArray;

@end

@implementation LimitTimeViewController

#pragma mark - 懒加载
-(LXSegmentScrollView *)segementView{

    if (!_segementView) {
        _segementView = [[LXSegmentScrollView alloc]initWithFrame:CGRectMake(0, 64, kWidth, 50) titleArray:self.titleArray contentViewArray:nil];
    }
    return _segementView;
}

-(NSMutableArray *)titleArray{

    if (!_titleArray) {
        _titleArray = [NSMutableArray arrayWithArray:@[@"全部",@"正在进行",@"即将开始",@"已售罄"]];
    }
    return _titleArray;
}

-(UITableView *)limitTableView{

    if (!_limitTableView) {
        _limitTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 114, kWidth, kHeight - 114)];
        _limitTableView.delegate = self;
        _limitTableView.dataSource = self;
    }
    return _limitTableView;
}


#pragma mark - 自定义


#pragma mark - 视图生命周期
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.segementView];
    [self.limitTableView registerNib:[UINib nibWithNibName:@"LimitCell" bundle:nil] forCellReuseIdentifier:@"limitCell"];
    [self.view addSubview:self.limitTableView];
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/


#pragma mark - 协议
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    LimitCell *cell = [tableView dequeueReusableCellWithIdentifier:@"limitCell" forIndexPath:indexPath];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 150;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    NSLog(@"%ld",indexPath.row);
}

@end
